package com.bytedance.common.utility.b;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

public final class ThreadPlusThreadFactory implements ThreadFactory {
    private String a;
    private AtomicInteger b;
    private boolean c;

    public ThreadPlusThreadFactory(String arg2, boolean arg3) {
        this.b = new AtomicInteger();
        this.a = arg2;
        this.c = arg3;
    }

    public ThreadPlusThreadFactory(String arg2) {
        this(arg2, false);
    }

    public final Thread newThread(Runnable arg5) {
        int v3 = 5;
        Thread v1 = new Thread(arg5, this.a + "-" + this.b.incrementAndGet());
        if(!this.c) {
            if(v1.isDaemon()) {
                v1.setDaemon(false);
            }

            if(v1.getPriority() == v3) {
                return v1;
            }

            v1.setPriority(v3);
        }

        return v1;
    }
}

